home *** CD-ROM | disk | FTP | other *** search
- Path: vela.acs.oakland.edu!jggoslin
- From: jggoslin@vela.acs.oakland.edu (Monument)
- Newsgroups: comp.lang.c
- Subject: Passing by reference and Returning structures
- Date: 10 Mar 1996 19:55:23 GMT
- Organization: Oakland University, Rochester, Michigan, U.S.A.
- Message-ID: <4hvc3b$avn@news2.acs.oakland.edu>
- NNTP-Posting-Host: vela.acs.oakland.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- I'm a mid level C programmer, not too advanced but not too green
- either. I have a question about a program I am writing for a unix box
- running OSF/1.
-
- I have to send a matrix of unknown size to a function, and return a
- filled structure. I don't have to change the matrix at all, and the
- buffer will be completely filled by the matrix.
-
- My question is, what does the return for a structure look like. I
- would assume the function prototype would look something like:
-
- my_struct my_function(int matrix[])
-
- and the call would be something like
-
- structure=my_function(matrix)
-
- where my_struct is the structure type and matrix is the variable size
- matrix. However, when I tried just such a setup it didn't work, gave
- me a whole mess of errors. If anyone has any ideas(a missing keyword,
- missing ref/deref operators, etc) please let me know. I need to
- change my_struct but not matrix, so feel free to change around the
- order and whatnot of the function prototype(ie if you just want it to
- return a void, etc)
-
- Thanx in advance
-
- ----------------------------------------------------------------------------
- | Jeff Goslin - Monument | "Oh Bentson, you are so |
- | jggoslin@vela.acs.oakland.edu | mercifully free from the |
- | | ravages of intellect." |
- | http://www.acs.oakland.edu/links/jggoslin | --Evil, The Time Bandits |
- ----------------------------------------------------------------------------
- | how come everyone elses religion is a cult but your cult is a religion |
- ----------------------------------------------------------------------------
-
-